
package com.diana;

/***************************** IMPORT *****************************/

import android.app.Activity;
import android.os.Bundle;
import android.util.Log;
import android.view.View;

import com.model.Carver;
import com.model.Dictionary;
import com.model.WriteDictionnary;
import com.view.*;



public class MainActivity extends Activity {

	/************ DECLARATIONS ***************/
	
	private DianaScreen dianaScreen;
	private ArchiveScreen archiveScreen;
	private Screen currentScreen;
	private Recorder recorder;
	private Carver carver;
	private Dictionary dictionary;


	/************** METHODES *****************/
	
	/**
	 * @brief Display the current screen.
	 */
	public void displayCurrentView(){
		this.setContentView(this.currentScreen.getLayout());
		this.currentScreen.display();
	}

	/**
	 * @brief Display the menu.
	 */
	public void menuAppears(View v){
		this.dianaScreen.showMenu();
	}

	/**
	 * @brief Load the activity.
	 */
	@Override
	public void onCreate(Bundle savedInstanceState){
		super.onCreate(savedInstanceState);  

		try {
			
			
			//Creation of Models
			this.carver = new Carver();
			
			//Creation of Controllers
			this.recorder = new Recorder(this);
			
			//Creation of Views
			this.dianaScreen = new DianaScreen(this);
			this.archiveScreen = new ArchiveScreen(this);
			
			//Creation of Dictionary
			this.dictionary = new Dictionary();
			new WriteDictionnary(this.dictionary, this);
			
			
		
			this.currentScreen = this.dianaScreen;
			displayCurrentView();
			
			//Log.e("token de hello",this.dictionary.getMap().get("hello").getWordType());
		}
		catch (Exception ex) {
			Log.e("MainActivty",ex.getMessage());
		}
	}

	
	/************* ACCESSORS *************/
	
	public Recorder getRecorder() {
		return recorder;
	}

	public void setRecorder(Recorder recorder) {
		this.recorder = recorder;
	}

	public Carver getCarver() {
		return carver;
	}

	public void setCarver(Carver carver) {
		this.carver = carver;
	}

}












